package daily;

import java.util.*;

public class MeiTuan04 {

    private static class Road{
        int walk;
        int car;
        public Road(int w, int c){
            walk = w;
            car = c;
        }
    }

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int start = sc.nextInt();
        int end = sc.nextInt();
        List<Map<Integer, Road>> path = new ArrayList<>();
        for(int i = 0; i < m; i++){
            path.add(new HashMap<>());
        }
        for(int i = 0; i < m; i++){
            int x1 = sc.nextInt()-1;
            int y1 = sc.nextInt()-1;
            int p1 = sc.nextInt();
            int p2 = sc.nextInt();
            path.get(x1).putIfAbsent(y1, new Road(p2, p1));
        }
        int[] cost = new int[n];
        for(int i = 0; i < n; i++){
            cost[i] = sc.nextInt();
        }
        dfs(start-1, end-1, cost, 0, path, false, 0);
        System.out.println(result);
    }

    static int result = Integer.MAX_VALUE;

    public static void dfs(int start, int end, int[] cost, int curCost, List<Map<Integer, Road>> path,
                           boolean isPreCar, int preCost){
        if(start == end){
            result = Math.min(curCost, result);
            return;
        }
        int wait = 0;
        if(isPreCar){
            wait = cost[start];
        }else{
            wait = cost[start] > curCost ? cost[start] - curCost : 0;
        }

        for(Map.Entry<Integer, Road> entry : path.get(start).entrySet()){
            int dist = entry.getKey();
            Road road = entry.getValue();
            int minCost = Integer.MAX_VALUE;
            if(isPreCar){
                if(road.car < wait+road.walk){
                    minCost = road.car;
                    dfs(dist, end, cost, curCost+minCost, path, true, minCost);
                }else{
                    // walk
                    minCost = wait+road.walk;
                    dfs(dist, end, cost, curCost+minCost, path, false, minCost);
                }
            }else{
                if(road.car+wait < road.walk){
                    minCost = road.car+wait;
                    dfs(dist, end, cost, curCost+minCost, path, true, minCost);
                }else{
                    // walk
                    minCost = road.walk;
                    dfs(dist, end, cost, curCost+minCost, path, false, minCost);
                }
            }
        }
    }
}
